package cn.fl.mcr.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.vo.McrLoanChannelVO;
import cn.lionbridgecapital.loan.model.dto.McrLoanChannelDTO;


/**
 * @Description: 机构（借款通道） 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrLoanChannelVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrLoanChannelDTO
	 * @return McrLoanChannelVO
	 */
	public static McrLoanChannelVO toVO(McrLoanChannelDTO dto) {
		McrLoanChannelVO  vo = null;
		if (dto != null) { 
			vo = new McrLoanChannelVO();
			vo.setId(dto.getId());
			vo.setLoanChannel(dto.getLoanChannel());//LOAN_CHANNEL
			vo.setLoanName(dto.getLoanName());//LOAN_NAME
			vo.setIsValid(dto.getIsValid());//IS_VALID
			vo.setIsDel(dto.getIsDel());//IS_DEL
			vo.setSocietyCreditCode(dto.getSocietyCreditCode());
			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
			vo.setRemainAmt(dto.getRemainAmt());
			vo.setSort(dto.getSort());
			vo.setBankSort(dto.getBankSort());
			vo.setCreditWeight(dto.getCreditWeight());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrLoanChannelVO
	 * @return McrLoanChannelDTO
	 */
	public static McrLoanChannelDTO toDTO(McrLoanChannelVO vo) {
		McrLoanChannelDTO dto = null;
		if (vo != null) {
			dto = new McrLoanChannelDTO();
			dto.setId(vo.getId());
			dto.setLoanChannel(vo.getLoanChannel());//LOAN_CHANNEL
			dto.setLoanName(vo.getLoanName());//LOAN_NAME
			dto.setIsValid(vo.getIsValid());//IS_VALID
			dto.setIsDel(vo.getIsDel());//IS_DEL
			dto.setSocietyCreditCode(vo.getSocietyCreditCode());
			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
			dto.setRemainAmt(vo.getRemainAmt());
			dto.setSort(vo.getSort());
			dto.setBankSort(vo.getBankSort());
			dto.setCreditWeight(vo.getCreditWeight());
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrLoanChannelDTO>
	 * @return List<McrLoanChannelVO>
	 */
	public static List<McrLoanChannelVO> toVOList(List<McrLoanChannelDTO> list) {
		List<McrLoanChannelVO>  voList = new ArrayList<McrLoanChannelVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanChannelDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrLoanChannelVO>
	 * @return List<McrLoanChannelDTO>
	 */
	public static List<McrLoanChannelDTO> toDTOList(List<McrLoanChannelVO> list) {
		List<McrLoanChannelDTO>  dtoList = new ArrayList<McrLoanChannelDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanChannelVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
